﻿using ChongJu.ModelManager.Rating;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace ChoJu.Converters.Rating
{
    public class AccountConverter : IValueConverter
    {
        public bool Overturn { get; set; } = false;

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
                return Overturn == false ? Visibility.Collapsed : Visibility.Visible;

            var status = (BatchEnum)value;
            BatchEnum para = (BatchEnum)Enum.Parse(typeof(BatchEnum), parameter.ToString());
            if (status == para)
                return Overturn == false ? Visibility.Visible : Visibility.Collapsed;
            else
                return Overturn == false ? Visibility.Collapsed : Visibility.Visible;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
